<% if previous_cards.any? %>
  <ul class="list-group mb-3">
    <%= f.fields_for :source, @payment.source do |source_form| %>
      <% previous_cards.each do |card| %>
        <li class="list-group-item p-0">
          <%= source_form.label :id, value: card.id, class: "form-check-label d-flex align-items-center gap-3 px-3 py-3 w-100 cursor-pointer hover-light" do %>
            <div class="form-check flex align-items-center">
              <%= source_form.radio_button :id, card.id, class: "form-check-input" %>
            </div>
            <%= payment_method_icon_tag(card.brand, width: 32, height: 32) %>
            <%= card.display_number %>
            <% if card.wallet_type.present? %>
              <%= payment_method_icon_tag(card.wallet_type, width: 32, height: 32) %>
            <% end %>
            <span class="text-muted ms-auto">(<%= card.month %>/<%= card.year %>)</span>
          <% end %>
        </li>
      <% end %>
    <% end %>
  </ul>
<% end %>
